package com.itheima.consumer.config;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author wyh
 * @Date 2025/5/11 17:09
 * @description:
 */
//@Configuration
public class DLXConfiguration {
    @Bean
    public Queue delayedQueue() {
        Map<String, Object> args = new HashMap<>();
        args.put("x-dead-letter-exchange", "order.exchange");
        args.put("x-dead-letter-routing-key", "order.routingKey");
        args.put("x-message-ttl", 1800000); // 设置TTL为30分钟
        return new Queue("delayed.queue", true, false, false, args);
    }
}
